﻿@using KRM.Core
@model dynamic

@{
    ViewBag.Title = "Product Instructions";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="~/css/plugins/dynatree/ui.dynatree.css" rel="stylesheet" />
<div class="container-fluid">
    <div class="page-header">
    </div>
    <div class="row-fluid">
        <div class="span12">
            <div class="box">
                <div class="box-title">
                    <h3><i class="icon-reorder"></i>Product Instruction</h3>
                </div>
                <div class="box-content">
                    <div class="row-fluid" style="line-height: 26px;">
                        <div class="span1">
                            <a  class="btn btn-primary"href="/products/ProductInstructions?path=@ViewBag.ParentPath&isShortCut=@Request["isShortCut"]">Back</a>
                        </div>
                        <div class="span5">
                            <div class="span1">Path:</div>
                            <div class="span11">
                                @*                            <input  type="text"class="input-block-level" value="@Server.UrlDecode(ViewBag.CurrentPath)" disabled="disabled"/>*@
                                <div class="input-block-level" style="padding: 0 2px 2px 2px;border: 1px solid #ccc;">
                                    <a  href = "/products/ProductInstructions" class="btn"style="padding: 3px 6px 3px 6px;"><i class="icon-home"></i> </a> 
                                    @{
                                        string path = Server.UrlDecode(ViewBag.CurrentPath);
                                        var url = (Request["isShortCut"]=="True"?"\\\\":"\\");
                                        if (path.Trim('\\')!="")
                                        {
                                            foreach (var item in path.Trim('\\').Split('\\'))
                                            {
                                                url = url + item + "\\";
                                                if (item != "kybotech.local")
                                                {
                                                    <a  href = "/products/ProductInstructions?path=@url&isShortCut=@Request["isShortCut"]"class="btn"style="padding: 3px 6px 3px 6px;">@item <i class="icon-angle-right"></i></a>
                                                }
                                            }
                                        }
                                    }
                                </div> 
                            </div>
                        </div>
                        <form action="/Products/ProductInstructions/" method="POST"class="span6">
                            <input type="hidden" name="path" value="@(Request["isShortCut"]=="True"?"":ViewBag.CurrentPath)" />
                            <div class="span2">Keyword:</div>
                            <div class="span6"><input  type="text"class="input-block-level" value="@Request["search"]" name="search" required="required"/></div>
                            <div class="span3"><button type="submit"class="btn btn-primary">Search</button>
                                <a href="/products/ProductInstructions?path=@ViewBag.CurrentPath" class="btn">Clear</a>
                            </div>
                        </form>
                    </div>
                    @Html.Partial("Partial/_MessageResult")
                    <div class="row-fluid">
                        <ul class="dynatree-container" style="font-size: 14px;line-height: 20px; min-height: 100px;min-height: 400px;">
                            @foreach (tblProductInstructionIndex item in ViewBag.ItemResults)
                            {
                                if (item.Type == 0)
                                {
                                    <li>
                                        <span class="dynatree-node dynatree-folder dynatree-ico-cf">
                                            <span class="dynatree-icon" style="margin-top: 3px"></span>
                                            <a href="/products/ProductInstructions?path=@Server.UrlEncode(item.Path+item.Name+"\\")&isShortCut=@Request["isShortCut"]" class="dynatree-title">
                                                @item.Name
                                            </a>
                                        </span>
                                    </li>
                                }
                                else
                                if (item.Type == 3)
                                {
                                    <li>
                                        <span class="dynatree-node dynatree-folder dynatree-ico-cf">
                                            <span class="dynatree-icon" style="margin-top: 3px"></span>
                                            <a href="/products/ProductInstructions?path=@Server.UrlEncode(item.Path.Replace(@"C:\Windows\SysWOW64\inetsrv","//"))&isShortCut=True" class="dynatree-title">
                                                @item.Name
                                            </a>
                                        </span>
                                    </li>
                                }
                                else
                                {
                                    <li>
                                        <span class="dynatree-node">
                                             <span class="dynatree-icon" style="margin-top: 3px"></span>
                                            <a href="/products/ProductInstructionFile?path=@Server.UrlEncode(item.Path+item.Name)&isShortCut=@Request["isShortCut"]" class="dynatree-title">
                                                @item.Name
                                            </a>
                                        </span>
                                    </li>
                                  
                                }
                            }
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
